package com.loveprogrammer.flomo;

import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.loveprogrammer.flomo.common.dto.FlomoSendResult;

import java.util.HashMap;
import java.util.Map;

/**
 * Company: ClickPaaS
 *
 * @version 1.0.0
 * @description: 发送
 * @author: 钱旭
 * @date: 2022-04-08 16:54
 **/
public class Send {

    public FlomoSendResult sendContent(String url,String content){
        Map<String,Object> params = new HashMap<>();
        params.put("content",content);
        String post = HttpUtil.post(url, params);
        return JSON.parseObject(post,FlomoSendResult.class);
    }

    public static void main(String[] args) {
        Send send = new Send();
        FlomoSendResult result = send.sendContent("https://flomoapp.com/iwh/NTM5NDYx/f912e2b43306236f0d7197661ef3cf2e/",
                "今天开通了flomo，这是通过api上传的文档，测试返回结果");
        System.out.println(JSON.toJSONString(result));
    }
}
